import request from '@/utils/request'

export default {
  getTreeList(searchModel) {
    return request({
      url: '/tree/list',
      method: 'get',
      params: {
        pageNo: searchModel.pageNo,
        pageSize: searchModel.pageSize,
        tname: searchModel.tname,
        time: searchModel.time,
        token: searchModel.token
      }
    })
  },
  calTree(data){
    return request({
      url: '/tree/cal',
      method: 'post',
      data: {
        tid: data.tid,
        values: data.values
      }
    })
  }
  ,
  getTreeById(tid) {
    return request({
      url: `/tree/${tid}`,
      method: 'get'
    });
  },
  updateTree(tree) {
    return request({
      url: '/tree',
      method: 'put',
      data: tree
    });
  },
  saveTree(tree) {
    return this.updateTree(tree);
  },
  deleteTreeById(tid) {
    return request({
      url: `/tree/${tid}`,
      method: 'delete'
    });
  },
}
